﻿#pragma once

namespace xy
{

namespace utils
{

template <typename T> class singleton
{
  public:
    /**
     * @brief 构造单例
     *
     * @return T&
     */
    static T &instance()
    {
        static T instance;
        return instance;
    }

  private:
    singleton() = default;
    ~singleton() = default;
    singleton(const singleton &) = delete;
    singleton &operator=(const singleton &) = delete;
};

} // namespace utils

} // namespace xy
